package com.oig.sys.auth.vo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
@Schema(description = "菜单按钮视图对象")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ResourceVo {
    @Schema(description = "主键id")
    private Integer id;

    @Schema(description = "所属子系统id 预留")
    private Integer systemId;

    @Schema(description = "编码")
    private String resourceCode;
    @Schema(description = "菜单按钮名称")
    private String resourceName;

    @Schema(description = "排序序号")
    private Integer sort;

    @Schema(description = "图标样式class")
    private String icoClass;

    @Schema(description = "上级菜单id")
    private Integer parentId;

    @Schema(description = "请求地址，主菜单可能有，前端用")
    private String pathUrl;

    @Schema(description = "按钮事件，按钮可能有，前端用")
    private String uiEvent;

    @Schema(description = "是否允许删除 1-允许 0-不允许")
    private String noDelFlag;

    @Schema(description = "是否支持通用查询")
    private String queryType;   //是否支持通用查询 0-通用查询 1-接口查询

    @Schema(description = "通用查询固定查询条件配置 格式：[{\"fieldName\":\"status\",\"symbol\":\"$in\",\"value\":[01,02]},{\"fieldName\":\"payStatus\",\"symbol\":\"$eq\",\"value\":\"01\"}]")
    private String queryConditionCfg ;
    @Schema(description = "通用查询,默认排序配置 格式{\"field\":\"ASC\"}")
    private String querySortCfg ;

    @Schema(description = "列表查询接口地址")
    private String apiUrl ;
    @Schema(description = "查询json描述符")
    private String jsonText ;

    @Schema(description = "列表界面是否支持tab子页0否 1是")
    private String isSupportTab;
    @Schema(description = "tab子页查询配置")
    private String tabCfgJson;

    @Schema(description = "是否在主菜单里显示 0-不显示 1-显示")
    private String isShow;
    @Schema(description = "是否纯粹查询界面 0-否 1-是")
    private String isQueryOnly;
    @Schema(description = "数据隔离范围 1-不隔离,2-按租户隔离")
    private String isPublicData;
    @Schema(description = "层级")
    private Integer level;

    @Schema(description = "添加人")
    private String createUserName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "添加时间")
    private Date createTime;

    @Schema(description = "最后修改人")
    private String lastUpdateName;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "最后修改时间")
    private Date lastUpdateTime;

    @Schema(description = "状态")
    private String status;

    @Schema(description = "功能说明,当不为空时，可以在按钮或菜单里tip展示")
    private String remark;

    @Schema(description = "菜单对应的列")
    private List<ResourceColumnVo> resourceColumnList ;

    @Schema(description = "功能菜单所需权限列表")
    private List<PermissionVo> permissionList ;

    @Schema(description = "下级")
    private List<ResourceVo> children;

    public ResourceVo(){
    }

    public ResourceVo(Integer id, Integer systemId, String resourceCode, String resourceName,Integer sort,
                      String icoClass,Integer parentId,String pathUrl,String uiEvent,String noDelFlag, String status,String remark,
                      String queryType, String queryConditionCfg, String querySortCfg, String apiUrl, String jsonText,
                      String isSupportTab, String tabCfgJson,String isShow,String isQueryOnly,
                      String isPublicData,Integer level, String createUserName, Date createTime, String lastUpdateName, Date lastUpdateTime){
        this.id = id;
        this.systemId = systemId;
        this.resourceCode = resourceCode;
        this.resourceName = resourceName;
        this.sort = sort;
        this.icoClass = icoClass;
        this.parentId = parentId;
        this.pathUrl = pathUrl;
        this.uiEvent = uiEvent;
        this.noDelFlag = noDelFlag;
        this.status = status;
        this.remark = remark;
        this.queryType = queryType;
        this.queryConditionCfg = queryConditionCfg;
        this.querySortCfg = querySortCfg;
        this.apiUrl = apiUrl;
        this.jsonText = jsonText;
        this.isSupportTab = isSupportTab;
        this.tabCfgJson = tabCfgJson;
        this.isShow = isShow;
        this.isQueryOnly = isQueryOnly;
        this.isPublicData = isPublicData;
        this.level = level;
        this.createUserName = createUserName;
        this.createTime = createTime;
        this.lastUpdateName = lastUpdateName;
        this.lastUpdateTime = lastUpdateTime;
    }
}
